<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>hot</title>
    <link rel="stylesheet" type="text/css" href="#(ctx_path)/static/h-ui/css/H-ui.min.css" />
    <link rel="stylesheet" type="text/css" href="#(ctx_path)/static/h-ui.admin/css/H-ui.admin.css" />
    <link rel="stylesheet" type="text/css" href="#(ctx_path)/lib/Hui-iconfont/1.0.8/iconfont.css" />
    <link rel="stylesheet" href="#(ctx_path)/lib/bootstrap/css/bootstrap.css">
    <link rel="stylesheet" href="#(ctx_path)/lib/layui/css/layui.css"  media="all">
    <style>
        #flash{
            padding: 8px 8px 0 8px;
        }
        .headNav{
            background:#FFFFFF;
            line-height: 40px;
            padding: 0px 8px;
            height:150px;
        }
        #headNav_1{
            height: 31px;
        }
        #headNav_1 span:first-child{
            color:red;
        }
        #headNav_1 span:nth-child(2){
            font-weight: bolder;font-size: 15px;
        }

        #headNav_2{
            border-top: 1px solid #cdcdcd;
        }
        #headNav_2 div:first-child{
            float: left;
            width:70%;height: 119px;padding:10px 10px 10px 25px;
        }
        #headNav_2 div:nth-child(2){
            float: left;width:30%;height: 119px;line-height: 120px;
        }
        .oneRow{
            background-color: rgb(243, 244, 247);
            height: 122px;
            padding: 10px 8px 0px 8px;
        }
        .content{
            height: 100%; 
            padding: 15px 8px 0 8px;
            background:white;
            border-radius: 8px;
        }
        .rowUp{
            position: relative;
            height: 48px;
            border-bottom:1px solid #EEECEC;
        }
        .rowDown{
        }
        .logo{
            display: inline-block;
            float: left;
            margin-right: 6px;
        }
        .div_des{
            color: #ABABAB;
            font-size: 11px;
        }
        .div_btn{
            position: absolute;
            right: 12px;
            cursor: pointer;
            top:8px;
            z-index: 100; 
            width: 70px;
            text-align: center; 
            line-height: 23px; 
            height: 23px;
            color: white;
            background: #229EE6; 
            border-radius: 15px;
            font-size: 11px;
        }
        .div1{
            float: left;
            width: 33.3%;
            text-align: left;
        }
        .div2{
            float: left;
            width: 33.3%;
        }
        .div2 p{
            text-align: center;
        }
        .div3{
            float: left;
            width: 33.3%;
            text-align: right;
        }
        .div3 p{
            text-align: right;
        }
        .div1>p:nth-child(1),.div2>p:nth-child(1),.div3>p:nth-child(1){
            margin: 0;
            color: #ABABAB;
            font-size: 11px;
        }
        .div1>p:nth-child(2),.div2>p:nth-child(2),.div3>p:nth-child(2){
            margin: 0;
            color: #FF782A;
        }
        #rowContent img{
            display:inline-block;
        }
        /*流加载button样式*/
        .layui-flow-more a cite{
            color: #9c9c9c;
            font-size: 15px;
            line-height: 20px;
            height: 20px;
        }
        .layui-flow-more,.layui-flow-more a{
            line-height: 20px;
            height: 20px;
        }
        #rowContent{
            padding-bottom:40px;
        }
        .apple{height:20px; overflow:hidden;}
        .apple ul li{height: 20px;}
        .apple a,.aa a{ width:100%; height:20px; line-height:20px; text-indent:20px; color:#1B96EE;}
    </style>
</head>
<body>

<div class="container">
  <div class="row" id="flash">
      <div id="myCarousel" class="carousel slide">
          <!-- 轮播（Carousel）指标 -->
          <ol class="carousel-indicators">

          </ol>
          <!-- 轮播（Carousel）项目 -->
          <div class="carousel-inner">
          </div>
          <a class="left carousel-control" href="#myCarousel" role="button" data-slide="prev">
              <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
              <span class="sr-only">Previous</span>
          </a>
          <a class="right carousel-control" href="#myCarousel" role="button" data-slide="next">
              <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
              <span class="sr-only">Next</span>
          </a>
      </div>
  </div>
    <div class="apple">
        <span class="glyphicon glyphicon-volume-up" style="float: left;line-height: 18px;color:#ff7656;"></span>
        <ul style="padding-left: 18px;">

            <li><a href="javascrip:void(0);" target="_blank" style="font-size: 11px;">已有<b style="color:red;">750819</b>人申请借款，最快<span style="color:red;">3分钟</span>放款</a></li>
            <li><a href="javascrip:void(0);" target="_blank" style="font-size: 11px;">已有<b style="color:red;">750819</b>人申请借款，最快<span style="color:red;">3分钟</span>放款</a></li>
            <li><a href="javascrip:void(0);" target="_blank" style="font-size: 11px;">已有<b style="color:red;">750819</b>人申请借款，最快<span style="color:red;">3分钟</span>放款</a></li>

        </ul>

    </div>

    <div class="row headNav">
        <div id="headNav_1">
            <span class="glyphicon glyphicon-fire"></span>&nbsp;
            <span >今日推荐</span>
        </div>
        <div id="headNav_2">
            <a href="">
                <div>
                    <p>
                        <i class="Hui-iconfont" style="font-size: 10px;color: #ffca00">&#xe630;</i>
                        三分钟放贷 贷款不再难
                    </p>
                    <p style="font-weight: bold;font-size: 25px;color:#ff484a;">简单 快速 借得到</p>
                </div>
                <div>
                    <img style="width:80px;height:80px;" src="" alt="logo">
                </div>
            </a>
        </div>
    </div>
    <div id="rowContent">

    </div>
</div>


    
</body>
<script src="http://pv.sohu.com/cityjson?ie=utf-8"></script>
<script type="text/javascript" src="#(ctx_path)/lib/bootstrap/js/jquery-1.10.2.min.js"></script>
<script type="text/javascript" src="#(ctx_path)/lib/bootstrap/js/bootstrap.js"></script>
<!--<script type="text/javascript" src="#(ctx_path)/lib/bootstrap/js/toucher.js"></script>-->
<script type="text/javascript" src="#(ctx_path)/lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="#(ctx_path)/lib/JSUtils/Tools.js"></script>
<script src="#(ctx_path)/lib/layui/layui.js" charset="utf-8"></script>
<script>
$(function(){
    isShowDetailPage = 'yes';
    initCarousel();
    /*initData(G_pageSize,G_pageNumber);*/
    touchSlide();
    $("#myCarousel").carousel('cycle');
    setInterval('autoScroll(".apple")',2000);
    loadTJ();
    notice();
});
function touchSlide(){
    var startX,endX;//声明触摸的两个变量
    var offset = 30;//声明触摸距离的变量
    $('.carousel-inner').on('touchstart',function (e) {
        startX= e.originalEvent.touches[0].clientX;//当触摸开始时的x坐标；
    });
    $('.carousel-inner').on('touchmove',function (e) {
        endX = e.originalEvent.touches[0].clientX;//当触摸离开时的x坐标；
    });
    $('.carousel-inner').on('touchend',function (e) {
        //当触摸完成时进行的事件；
        var distance = Math.abs(startX - endX);//不论正负，取值为正值；
        if (distance > offset){
            if(startX > endX){
                $('#myCarousel').carousel('next');//当开始的坐标大于结束的坐标时，滑动到下一附图
            }else{
                $('#myCarousel').carousel('prev');//当开始的坐标小于结束的坐标时，滑动到上一附图

            }

        }
    });
}

function initCarousel(){
    $.ajax({
        type: 'POST',
        url: '#(ctx_path)/mobile/productList/loadCuFlashByCache.html',
        data: null,
        dataType: 'json',
        async:false,
        success: function (data) {
            if(data.length != 0){
                var pageHtml = "";
                var html = "";
                for (var i = 0; i < data.length; i++) {
                    if(i == 0){
                        pageHtml += "<li data-target=\"#myCarousel\" data-slide-to=\""+i+"\" class=\"active\" ></li>&nbsp;";
                        html += "<div class=\"item active\">";
                    }else{
                        pageHtml += "<li data-target=\"#myCarousel\" data-slide-to=\""+i+"\"></li>&nbsp;";
                        html += "<div class=\"item\">";
                    }
                    html += '<a  target=\'_blank\' href=\'javascript:statistics("#(ctx_path)",'+ data[0].itemid +',"'+ data[0].url + '","'+ isShowDetailPage + '");\'>';
                    html += "   <img src='#(ctx_path)/upload/"+data[i].photo+"' style='height: 170px;width: 100%;' >";
                    html += "</a>";
                    html += "</div>";
                }
                $(".carousel-indicators").html(pageHtml);
                $(".carousel-inner").html(html);
            }
        },
        error:function(data) {
            layer.msg('系统错误，请联系管理员！', {icon: 5,time:1500});
            console.log(data);
        }
    });
    
}


var G_pageSize = 8;//每一页的数量
var G_pageNumber;//当前页

layui.use('flow', function(){
    var flow = layui.flow;
    flow.load({
        elem: '#rowContent' //流加载容器
        ,isAuto:false
        ,done: function(G_pageNumber, next){ //执行下一页的回调
            initData(1,$("#rowContent"),G_pageSize,G_pageNumber,next);
        }
    });
});



//今日推荐
function loadTJ(){
    $.ajax({
        type: 'POST',
        url: '#(ctx_path)/mobile/productList/findTJItemByConf',
        data: {},
        async:false,//同步
        dataType: 'json',
        success: function (data) {
            var href="javascript:statistics('#(ctx_path)',"+ data.id +",'"+ data.url + "','"+ isShowDetailPage + "');";
            $("#headNav_2").find("a").attr("href",href);
            $("#headNav_2").find("img").attr("src","#(ctx_path)/upload/"+data.logo);
        },
        error:function (data) {
            layer.msg('系统错误，请联系管理员！', {icon: 5,time:1500});
            console.log(data);
        }
    });
}

function initData(num,obj,Size,Number,next){
    var lis = [];
    //初始化第一页数据
    Number = Number || 1;
    var parms = {"gid":num,"onOff":"on","pageNumber":Number,"pageSize":Size};
    $.ajax({
        type: 'POST',
        url: '#(ctx_path)/mobile/productList/findMobileItemByGroupId',
        data: parms,
        async:false,//同步
        dataType: 'json',
        success: function (data) {
            var totalPage = data.totalPage;//总页数
            var pageNumber = data.pageNumber;//当前页
            var totalRow = data.totalRow;//总条数
            for (var i = 0; i < data.list.length; i++) {
                var html = "";
                html+= '<div class="row oneRow">';
                html+= '    <div class="content">';
                html+= '    <div class="rowUp">';
                html+= '    <img src="" class="logo" width="40px" height="40px" alt="">';
                imgArr.push('#(ctx_path)/upload/'+ data.list[i].logo);
                html+= '    <div  alt="name">'+ data.list[i].name +'</div>';
                html+= '    <div class="div_des" alt="description">'+ data.list[i].description +'</div>';
                html+= '<a class="div_btn" href="javascript:statistics('+'\'#(ctx_path)\','+ data.list[i].id +',\''+ data.list[i].url + '\',\''+ isShowDetailPage + '\');" >立即申请</a>';
                html+= '    </div>';
                html+= '    <div class="rowDown">';
                html+= '    <div class="div1">';
                html+= '    <p>额度最高</p>';
                html+= '    <p>'+ data.list[i].maxlimit +'</p>';
                html+= '</div>';
                html+= '<div class="div2">';
                html+= '    <p>日利率最低</p>';
                html+= '    <p>'+ data.list[i].rate +'</p>';
                html+= '    </div>';
                html+= '    <div class="div3">';
                html+= '    <p>借款期限</p>';
                html+= '    <p>'+ data.list[i].deadline +'</p>';
                html+= '</div>';
                html+= '</div>';
                html+= '</div>';
                html+= '</div>';
                lis.push(html);
            }
            next(lis.join(''), pageNumber < totalPage);
        },
        error:function (data) {
            layer.msg('系统错误，请联系管理员！', {icon: 5,time:1500});
            console.log(data.msg);
        }
    });
    setTimeout(initImg(obj),1000);
}


function flashLocation(url){
    top.location.href=url;
}


function autoScroll(obj){

    $(obj).find("ul").animate({
        marginTop : "-20px"
    },1000,function(){
        $(this).css({marginTop : "0px"}).find("li:first").appendTo(this);
    })

}

function notice(){
    $.ajax({
        type: 'POST',
        url: '#(ctx_path)/mobile/productList/findShowTextById',
        data: {"id":1},
        async:false,//同步
        dataType: 'json',
        success: function (data) {
            var showtext = data.result.showtext;
            var htmlStr = "";
            for (var i=0;i<3;i++){
                htmlStr += "<li><a href=\"javascript:void(0);\" target=\"_blank\" style=\"font-size: 11px;\">"+ showtext +"</a></li>";
            }
            $(".apple ul").html(htmlStr);

        },
        error:function (data) {
            layer.msg('系统错误，请联系管理员！', {icon: 5,time:1500});
            console.log(data.msg);
        }
    });
}

</script>
</html>